<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    let item = 6;
    var arr = [2, 3, 6, 3, 5, 6, 6, 6, 6, 6, 7];
    for (var i = 0; i < arr.length; i++) {
        if (arr[i] == item) {
            arr.splice(i, 1);
            // console.log(i, arr);
            i--;
            // console.log(i, arr[i]);
        }
    }
    console.log(arr);
</script>

<script>
    function listArray(head) {
        if (!head) {
            return []
        }
        var result = [head.value]
        var restValues = list2array(head.next)
        return result.concat(restValues)
    }
</script>

</html>